package dao

import (
	"go.uber.org/zap"
	__ "hospital-srv/basic/proto"
	"hospital-srv/handler/models"
	"hospital-srv/pkg"
	"time"
)

func GetCollectRetail(in *__.InstrumentReq) models.Collect {
	collect := models.Collect{
		UserId:                      int32(in.UserId),
		TempValue:                   in.TempValue,
		BloodSugarValue:             in.BloodSugarValue,
		SystolicBloodPressureValue:  in.SystolicBloodPressureValue,
		DiastolicBloodPressureValue: in.DiastolicBloodPressureValue,
		BloodOxygenValue:            in.BloodOxygenValue,
		DeviceID:                    in.DeviceID,
		CreatedAt:                   time.Now(),
	}
	if err := collect.Create(); err != nil {
		pkg.Error("MQTT原始数据写入Mongo失败", zap.Error(err))
	}
	return collect
}
